{% load i18n %}
<div class="btn-group import">
  <a class="dropdown-toggle btn btn-default btn-sm" data-toggle="dropdown" href="#">
    <i class="fa fa-share"></i> {% trans "导入" %} <span class="caret"></span>
  </a>
  <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
    {% for et in import_types %}
      <li><a data-toggle="modal" data-target="#import-modal-{{et.type}}"><i class="fa fa-arrow-circle-down"></i> {% trans "导入" %} {{et.name}}</a></li>
    {% endfor %}
  </ul>

  {% for et in import_types %}
    <div id="import-modal-{{et.type}}" class="modal fade">
      <div class="modal-dialog">
        <div class="modal-content">
          <form method="post" action="" enctype="multipart/form-data">{% csrf_token %}
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            <h4 class="modal-title">{% trans "导入" %} {{et.name}}</h4>
          </div>
          <div class="modal-body">
            {{ form_params|safe }}
            <input type="hidden" name="import_type" value="{{et.type}}">
              <label class="input">
{#                {% if et.type == "xlsx" %}#}
                <input type="file" name="import_file" >
{#                {% endif %}#}
{#                {% if et.type == "xls" %}#}
{#                <input type="file" name="import_file" >#}
{#                {% endif %}#}
{#                {% if et.type == "csv" %}#}
{#                <input type="file" name="import_file">#}
{#                {% endif %}#}
{#                {% if et.type == "xml" %}#}
{#                <input type="file" name="import_file" >#}
{#                {% endif %}#}
{#                {% if et.type == "json" %}#}
{#                <input type="file" name="import_file">#}
{#                {% endif %}#}
{#                <input type="hidden" name="qqqq" value = 'ssda'>#}
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">{% trans "Close" %}</button>
            <button class="btn btn-success" type="submit"><i class="fa fa-share"></i> {% trans "导入" %}</button>
          </div>
          </form>
        </div><!-- /.modal-content -->
      </div><!-- /.modal-dalog -->
    </div><!-- /.modal -->
  {% endfor %}

</div>